<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>写出至少三种变量定义的方式 并指出区别</title>
</head>
<body>
    <script>
        //1、使用var定义变量，变量可以修改，可以不初始化，没有初始化输出undefined；
        var uname
        console.log(uname)//undefined
        
        //2.使用const定义变量，变量不可以修改，且必须初始化
        // const uname 
        // console.log(uname)////语法报错
        const uname = 'ruby'
        console.log(uname)//ruby
        // 3.let 不允许相同作用域下多次申请同一变量
        // var uname = 'ruby'
        // var uname = 'zoe'
        // console.log(uname)//zoe

        let uname = 'ruby'
        let uname = 'zoe'
        console.log(uname)//Uncaught SyntaxError: Identifier 'uname' has already been declared

    </script>
</body>
</html>